package common.entity;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.DateConverter;

import java.util.List;

/**
 * 构造机构树
 * @author w_jx
 */
@Slf4j
@Data
public class SysEsbZcjgEntityTree extends SysEsbZcjgEntity {

    private List<SysEsbZcjgEntityTree> children;

    private String jgmc;

    private String jgbm;

    public static SysEsbZcjgEntityTree clone(SysEsbZcjgEntity zcjgEntity){
        SysEsbZcjgEntityTree entityVo = new SysEsbZcjgEntityTree();
        try {
            BeanUtilsBean.getInstance().getConvertUtils().register(false, false, 0);
            ConvertUtils.register(new DateConverter(null), java.util.Date.class);
            BeanUtils.copyProperties(entityVo,zcjgEntity);
        } catch (Exception e) {
            log.error("对象克隆失败",e);
            return null;
        }
        return entityVo;
    }

}